<template>
	<view class="bg-white" >
		<cu-custom :bgColor="NavBarColor" :isBack="true" backFlag="navigate">
			<block slot="backText">返回</block>
			<block slot="content">报警详情</block>
		</cu-custom>
		<view class="cu-list menu margin-top">
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">用户名称:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.userName}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">设备编号:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.dtuID}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">采集点:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.dpname}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">报警级别:</text>
				</view>
				<view class="action" v-if="annotation.warnLeavel=='1'">
				  <text class="text-black title " style="color: orange;">一级报警</text>
				</view>
				<view class="action" v-if="annotation.warnLeavel=='2'">
				  <text class="text-black title " style="color: red;">二级报警</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view>
					<text class="text-black title ">报警类型:</text>
				</view>
				<view class="action" v-if="annotation.warnType=='001'">
				  <text class="text-black title ">压力超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='002'">
				  <text class="text-black title ">压力过小</text>
				</view>
				<view class="action" v-if="annotation.warnType=='003'">
				  <text class="text-black title ">压力变化超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='004'">
				  <text class="text-black title ">温度超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='005'">
				  <text class="text-black title ">温度过低</text>
				</view>
				<view class="action" v-if="annotation.warnType=='006'">
				  <text class="text-black title ">温度变化超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='007'">
				  <text class="text-black title ">温度过大</text>
				</view>
				<view class="action" v-if="annotation.warnType=='008'">
				  <text class="text-black title ">流量过小</text>
				</view>
				<view class="action" v-if="annotation.warnType=='009'">
				  <text class="text-black title ">流量变化超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='010'">
				  <text class="text-black title ">数据异常</text>
				</view>
				<view class="action" v-if="annotation.warnType=='110'">
				  <text class="text-black title ">燃气泄露报警</text>
				</view>
				<view class="action" v-if="annotation.warnType=='101'">
				  <text class="text-black title ">设备交流电掉电</text>
				</view>
				<view class="action" v-if="annotation.warnType=='102'" >
				  <text class="text-black title ">设备门被打开</text>
				</view>
				<view class="action" v-if="annotation.warnType=='103'">
				  <text class="text-black title ">设备电池电压过低</text>
				</view>
				<view class="action" v-if="annotation.warnType=='104'" >
				  <text class="text-black title ">强磁干扰</text>
				</view>
				<view class="action" v-if="annotation.warnType=='114'">
				  <text class="text-black title ">磁干扰检测断线</text>
				</view>
				<view class="action" v-if="annotation.warnType=='105'">
				  <text class="text-black title ">采集器压力超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='106'">
				  <text class="text-black title ">采集器压力过小</text>
				</view>
				<view class="action" v-if="annotation.warnType=='107'">
				  <text class="text-black title ">采集器温度超限</text>
				</view>
				<view class="action" v-if="annotation.warnType=='108'">
				  <text class="text-black title ">采集器温度过低</text>
				</view>
				<view class="action" v-if="annotation.warnType=='201'">
				  <text class="text-black title ">通信失败</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">报警时间:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.revDate}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">报警时长:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.duration}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">报警值:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.warnValue}}</text>
				</view>
			</view>

			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">报警信息:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.txtMessage}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">处理状态:</text>
				</view>
				<view class="action" v-if="annotation.dealStatus=='0'">
				  <text class="text-black title " style="color: red;">未处理</text>
				</view>
				<view class="action" v-if="annotation.dealStatus=='1'">
				  <text class="text-black title " style="color: green;">已处理</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">处理人:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.dealer}}</text>
				</view>
			</view>
			<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
				<view class="content">
					<text class="text-black title ">处理时间:</text>
				</view>
				<view class="action">
					<text class="text-black title ">{{annotation.dealTime}}</text>
				</view>
			</view>
			<view class="cu-form-group" >
				<view class="content">
					<text class="text-black title ">处理说明:</text>
				</view>
				<textarea 
					style="border:solid 1px #3c9cff; border-radius:8px; resize:none; margin-left: 1rem;height:70px;overflow:auto" 
					placeholder-style="position: absolute;left:1.2rem;top:0.7rem" 
					placeholder="请输入处理说明" 
					name="input" 
					v-model="annotation.dealDetail">
				</textarea>
			</view>
<!-- 			<view class="padding flex flex-direction">
				<button class="cu-btn bg-blue lg"  @click="showPic()">查看图片</button>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				NavBarColor:this.NavBarColor,
				annotation:{
					id:"",
					titile:"",
					startTime:"",
					sender:"",
					msgContent:"",
					recordVideo:"",
					userId:"",
					longitude:'',
					dimension:'',
				},
				goodNumber:null,
				flg:true,
				src:"",
				pic:"",
				userId:"",
				id:"",
	
			}
		},
		// onLoad:function(){
		// 	console.log("this.$Route.query",this.$Route);
		// 	let query = this.$Route.query
		// 	if(query){
		// 		this.annotation = query;
		// 		}
		// },
		onLoad: function (option) {
		    const annItem = JSON.parse(decodeURIComponent(option.item));
			this.annotation = annItem
			console.log('’%%%%%%%%%%%%',this.annotation)
			
			this.pic=this.annotation.picture
			this.userId=this.annotation.userid
			this.id=this.annotation.id
			console.log("jjs"+this.userId)
	
			/* this.src=this.annotation.reportVideo
			this.pic=this.annotation.reportPic
			console.log(this.annotation.recordPic) */
		},
		created(){
			console.log("created")
			//this.readOk();
		},
		methods:{
			formatDate(text,len){
				if(!text || text.length==0){
					return ''
				}
				if(text.length<len){
					return text;
				}
				return text.substr(0,len)
			},showPic() {
			   console.log(this.pic)
					uni.navigateTo({
						url: '/pages/common/commonPic?item='+this.pic
					})
		   }
		}
	}
</script>

<style>
</style>